package bb.lanxing.model.json;

import android.os.Parcel;
import android.os.Parcelable;

import com.alibaba.fastjson.annotation.JSONType;
import com.baidu.mapapi.model.LatLng;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import bb.lanxing.util.BiCiCoorConverter;
import bb.lanxing.util.PolyUtil;

@JSONType(ignores = {"polyPath"})
public class RoutePolyline implements Parcelable, Serializable {
    public static final Creator<RoutePolyline> CREATOR = new Creator<RoutePolyline>() {
        @Override
        public RoutePolyline createFromParcel(Parcel parcel) {
            return new RoutePolyline(parcel);
        }

        @Override
        public RoutePolyline[] newArray(int i) {
            return new RoutePolyline[i];
        }
    };
    private String points;

    @Override
    public int describeContents() {
        return 0;
    }

    public List<LatLng> getPolyPath() {
        List<LatLng> decode = PolyUtil.decode(this.points);
        ArrayList arrayList = new ArrayList(decode.size());
        for (LatLng latLng : decode) {
            arrayList.add(BiCiCoorConverter.common2Earth(latLng));
        }
        return arrayList;
    }

    public String getPoints() {
        return this.points;
    }

    public void setPoints(String str) {
        this.points = str;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeString(this.points);
    }

    public RoutePolyline() {
    }

    public RoutePolyline(String str) {
        this.points = str;
    }

    protected RoutePolyline(Parcel parcel) {
        this.points = parcel.readString();
    }
}
